<template>
	<view class="collageActivity">
		<!-- 列表 -->
		<view class="list flex-r-b-c" v-for="(item,index) in collageList" :key="index" @tap="goCollageLaunch(item.id)">
			<image :src="url + item.image" mode=""></image>
			<view class="list_f">
				<view class="list_f_t flex-r-s-c">
					<view class="name">{{item.name}}</view>
					<view class="text">拼团有礼</view>
				</view>
				<view class="introduce one-line-ellipsis">已有{{item.cnum}}人已拼成{{item.num}}件</view>
				<view class="list_f_b flex-r-s-c">
					<view class="list_money flex-r-c-c">
						<view class="text">拼团价</view>
						<view class="money">¥<text>{{item.price}}</text></view>
					</view>
					<view class="btn">去拼团  <u-icon name="arrow-right" color="#FFF" size="26"></u-icon> </view>
				</view>
			</view>
		</view>
		<view class="text" style="width: 100%; text-align: center; font-size: 32rpx; font-weight: bold;">{{titleText}}</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				url: this.$base.smallimgUrl,
				page: 1, // 页码
				collageList: [], // 拼团列表
				titleText: '', // 上拉提示
			};
		},
		onLoad() {
			this.getCollageList() // 获取拼团列表
		},
		onReachBottom() {
			let that = this
			if(that.titleText == ''){ // 防止上拉多次请求
				that.page = that.page+1
				that.getCollageList()
			}
		},
		methods:{
			// 获取拼团列表
			getCollageList(){
				let that = this
				that.$api.collage_list({page: that.page}).then(res => {
					console.log(res)
					that.titleText = res.data.data.length == 0 ? '暂无数据' : ''
					that.collageList = that.collageList.concat(res.data.data)
				})
			},
			// 跳转到拼团参与
			goCollageLaunch(id){
				uni.navigateTo({
					url: '/order/collageLaunch/collageLaunch?id=' + id
				})
			}
		}
	}
</script>

<style lang="less">
	.collageActivity{
		width: 90vw;
		margin: 0 auto;
		.list{
			margin: 40rpx auto;
			width: 100%;
			height: auto;
			box-sizing: border-box;
			padding: 30rpx;
			background-color: #FFFFFF;
			border-radius: 30rpx;
			
			image{
				width: 236rpx;
				height: 194rpx;
				border-radius: 10rpx;
			}
			.list_f{
				width: 59%;
				line-height: 60rpx;
				.list_f_t{
					.name{
						font-size: 32rpx;
						font-weight: bold;
						color: #3B3B3B;
					}
					.text{
						width: 108rpx;
						height: 40rpx;
						line-height: 40rpx;
						text-align: center;
						background-color: #FF6C1D;
						color: #FFFFFF;
						font-size: 20rpx;
						font-weight: 500;
						border-radius: 10rpx;
						margin-left: 20rpx;
					}
				}
				.introduce{
					color: #959595;
					font-weight: 500;
					font-size: 24rpx;
				}
				//
				.list_f_b{
					height: 62rpx;
					background-color: #F5F5F5;
					border-radius: 10rpx;
					margin-top: 10rpx;
					.list_money{
						width: 60%;
						.text{
							color: #5D5D5D;
							font-size: 24rpx;
							font-weight: 500;
						}
						.money{
							margin-left: 8rpx;
							color: #FF6C1D;
							font-size: 34rpx;
							font-weight: 400;
							text{
								margin-left: 4rpx;
								display: inline-block;
								font-size: 38rpx;
								font-weight: bold;
							}
						}
					}
					.btn{
						width: 40%;
						background-color: #FF6C1D;
						border-radius: 10rpx;
						line-height: 62rpx;
						text-align: center;
						color: #FFFFFF;
						font-size: 28rpx;
						font-weight: bold;
					}
				}
			}
			
		}
	}
</style>
